﻿using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;

public class LoadLevel : MonoBehaviour
{
    Slider slider;
    AsyncOperation ao;
    void Start()
    {
        slider = GetComponent<Slider>();
        StartCoroutine(LoadLevelAsync());
    }
    IEnumerator LoadLevelAsync()
    {
        ao = SceneManager.LoadSceneAsync(1);
        yield return ao;
    }
    private void Update()
    {
        slider.value = ao.progress;
    }
}
